package com.agriculture.competition.service.impl;

import com.agriculture.common.core.utils.DateUtils;
import com.agriculture.competition.domain.JaCompetitionGroup;
import com.agriculture.competition.mapper.JaCompetitionGroupMapper;
import com.agriculture.competition.service.IJaCompetitionGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 比赛团体关联Service业务层处理
 *
 * @author agriculture
 * @date 2025-03-04
 */
@Service
public class JaCompetitionGroupServiceImpl implements IJaCompetitionGroupService {
    @Autowired
    private JaCompetitionGroupMapper jaCompetitionGroupMapper;

    /**
     * 查询比赛团体关联
     *
     * @param id 比赛团体关联主键
     * @return 比赛团体关联
     */
    @Override
    public JaCompetitionGroup selectJaCompetitionGroupById(Long id) {
        return jaCompetitionGroupMapper.selectJaCompetitionGroupById(id);
    }

    /**
     * 查询比赛团体关联列表
     *
     * @param jaCompetitionGroup 比赛团体关联
     * @return 比赛团体关联
     */
    @Override
    public List<JaCompetitionGroup> selectJaCompetitionGroupList(JaCompetitionGroup jaCompetitionGroup) {
        return jaCompetitionGroupMapper.selectJaCompetitionGroupList(jaCompetitionGroup);
    }

    /**
     * 新增比赛团体关联
     *
     * @param jaCompetitionGroup 比赛团体关联
     * @return 结果
     */
    @Override
    public int insertJaCompetitionGroup(JaCompetitionGroup jaCompetitionGroup) {
        jaCompetitionGroup.setCreateTime(DateUtils.getNowDate());
        return jaCompetitionGroupMapper.insertJaCompetitionGroup(jaCompetitionGroup);
    }

    /**
     * 修改比赛团体关联
     *
     * @param jaCompetitionGroup 比赛团体关联
     * @return 结果
     */
    @Override
    public int updateJaCompetitionGroup(JaCompetitionGroup jaCompetitionGroup) {
        jaCompetitionGroup.setUpdateTime(DateUtils.getNowDate());
        return jaCompetitionGroupMapper.updateJaCompetitionGroup(jaCompetitionGroup);
    }

    /**
     * 批量删除比赛团体关联
     *
     * @param ids 需要删除的比赛团体关联主键
     * @return 结果
     */
    @Override
    public int deleteJaCompetitionGroupByIds(Long[] ids) {
        return jaCompetitionGroupMapper.deleteJaCompetitionGroupByIds(ids);
    }

    /**
     * 删除比赛团体关联信息
     *
     * @param id 比赛团体关联主键
     * @return 结果
     */
    @Override
    public int deleteJaCompetitionGroupById(Long id) {
        return jaCompetitionGroupMapper.deleteJaCompetitionGroupById(id);
    }
}
